package org.boulderfoodrescue.webapp.shared;

import java.io.Serializable;

public class UserAccount extends UserAccountDetails implements Serializable{
	private static final long serialVersionUID = 2779339899670935629L;
	private String address;
	private String city;
	private Long state;
	private String zipCode;
	private TransportationType transportation;
	private String phoneNumber;
	private String passcode;
	private boolean activated = false;
	private PreferedContactMethod preferedContactMethod;
	private String alternateEmail;
	private Boolean hasCar;
	private String notes;

	public UserAccount() {
		super();
		this.address = "";
		this.city = "";
		this.state = (long)0;
		this.zipCode = "";
		this.transportation = TransportationType.Bike;
		this.phoneNumber = "";
		this.passcode = (new RandomString(8)).nextString(); 
		preferedContactMethod = PreferedContactMethod.Gmail;
		hasCar = false;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Long getState() {
		return state;
	}

	public void setState(Long state) {
		this.state = state;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public TransportationType getTransportation() {
		return transportation;
	}

	public void setTransportation(TransportationType transportation) {
		this.transportation = transportation;
	}

	public Long getTransportationAsLong() {
		switch(transportation)
		{
		case Bike: return 0l;
		case Car: return 1l;
		case Walking: return 2l;
		case Other: return 3l;
		}
		return 0l;
	}

	public void setTransportationViaLong(Long transportation) {
		switch(transportation.intValue())
		{
		case 0: this.transportation = TransportationType.Bike;break;
		case 1: this.transportation = TransportationType.Car;break;
		case 2: this.transportation = TransportationType.Walking; break;
		case 3: this.transportation = TransportationType.Other; break;
		}
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public boolean isActivated() {
		return activated;
	}

	public void setActivated(boolean activated) {
		this.activated = activated;
	}


	public String getPasscode() {
		return passcode;
	}

	public void setPasscode(String passcode) {
		this.passcode = passcode;
	}

	public PreferedContactMethod getPreferedContactMethod() {
		return preferedContactMethod;
	}

	public void setPreferedContactMethod(PreferedContactMethod preferedContactMethod) {
		this.preferedContactMethod = preferedContactMethod;
	}

	public Long getPreferedContactMethodAsLong(){
		switch(preferedContactMethod)
		{
		case Gmail: return 0l;
		case AltEmail: return 1l;
		case Phone: return 2l;
		case Facebook: return 3l;
		}
		return 0l;
	}

	public void setPreferedContactMethodViaLong(Long preferedContactMethod){
		switch(preferedContactMethod.intValue())
		{
		case 0: 
			this.preferedContactMethod = PreferedContactMethod.Gmail;
			break;
		case 1: 
			this.preferedContactMethod = PreferedContactMethod.AltEmail;
			break;
		case 2: 
			this.preferedContactMethod = PreferedContactMethod.Phone;
			break;
		case 3: 
			this.preferedContactMethod = PreferedContactMethod.Facebook;
			break;
		}
	}
	

	public String getAlternateEmail() {
		return alternateEmail;
	}

	public void setAlternateEmail(String alternateEmail) {
		this.alternateEmail = alternateEmail;
	}

	public Boolean getHasCar() {
		return hasCar;
	}

	public void setHasCar(Boolean hasCar) {
		this.hasCar = hasCar;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

}
